
//
//  MyView.m
//  <18> 绘制带属性的字体
//
//  Created by chen on 16/9/19.
//  Copyright © 2016年 tyrad. All rights reserved.
//

#import "MyView.h"

@implementation MyView

- (void)drawRect:(NSRect)dirtyRect {
    [super drawRect:dirtyRect];
    
    
    //属性字符串
    NSMutableAttributedString *string  ;
    
    string = [[NSMutableAttributedString alloc]initWithString:@"Big Times Roman"];
    [string addAttribute:NSFontAttributeName value:[NSFont userFontOfSize:22] range:NSMakeRange(0, 8)];
    [string addAttribute:NSUnderlineStyleAttributeName value:@(1) range:NSMakeRange(0, 3)];
    
    //可以绘制在view上
    [string drawInRect:self.bounds];
    

    NSFontManager *manager = [NSFontManager sharedFontManager];
    
    //NSFont * boldFont = [manager convertFont:aFont toHaveTrait:NSBoldFontMask];
    
    

}

@end
